<ul class="gallery">
    <?php 
            $imgPath = MEDIA_FOLDER . DS . "gallery" . DS .$data->picture;
    ?>
    <li>
        <div>
            <?php 
                if(file_exists($imgPath)){
                    $img = CHtml::image(url('gallery/thumbnails', array('f'=>$imgPath,
                                                                    'w'=>  LGConstant::FRONTEND_GALLERY_IMAGE_WIDTH,
                                                                    'h'=>LGConstant::FRONTEND_GALLERY_IMAGE_HEIGHT,                                                                    
                                                                )),
                                        CHtml::encode($data->name)
                            );
                    echo CHtml::link($img,GALLERY_URL.'/'.$data->picture, array('class'=>'grouped_image',
                                                                                        'rel'=>'slide[photos]',
                                                                ));
                }
                else{
                    echo CHtml::image(GALLERY_URL.'/'.LGConstant::FRONTEND_GALLERY_NO_PHOTO);                    
                }
            ?>
        </div>
    </li>
</ul>
